{extend name=".././view/create.html" /}
{block name="jscss"}
<style>
	.dh {
      min-height:50px;
      size:24px;
      padding-top:10px;
      text-align:center;
      min-height: 30px;
      float: left;
      margin-right: 1px;
    }
    .wancheng {
      border-bottom: 3px solid #01AAED;
    }

    .jinxing {
      border-bottom: 3px solid #FF5722;
    }

    .weicaozuo {
      border-bottom: 3px solid #FFB800;
    }
  </style>
{/block}
{block name="form"}
<div class="layui-form-item">
	<div class="dh wancheng" style="width: 10%;">开始</div>
	<div class="dh jinxing" style="width: 20%;">考试信息</div>
	<div class="dh weicaozuo" style="width: 20%;">各年级参加考试学科和分数线</div>
	<div class="dh weicaozuo" style="width: 20%;">生成参加考试学生名单</div>
	<div class="dh weicaozuo" style="width: 20%;">分配录入成绩任务</div>
	<div class="dh weicaozuo" style="width: 9%;">完成</div>
</div>
<form class="layui-form layui-form-pane" lay-filter="myform">
	<div class="layui-form-item">
		<label for="title" class="layui-form-label">
			<span class="x-red">*</span>考试名称
		</label>
		<div class="layui-input-block">
			<input type="text" id="title" name="title" lay-verify="required" autocomplete="off" class="layui-input " value="{$list.data.title|default=''}" placeholder="2-25个字符">
		</div>
	</div>
	<div class="layui-form-item">
		<label for="xueqi_id" class="layui-form-label"><span class="x-red">*</span>学期</label>
		<div class="layui-input-block">
			<select name="xueqi_id" id="xueqi_id" lay-verify="required">
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<label for="zuzhi_id" class="layui-form-label"><span class="x-red">*</span>组织单位</label>
		<div class="layui-input-block">
			<select name="zuzhi_id" id="zuzhi_id" lay-verify="required">
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<label for="category_id" class="layui-form-label"><span class="x-red">*</span>类别</label>
		<div class="layui-input-block">
			<select name="category_id" id="category_id" lay-verify="required">
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-inline">
			<label for="title" class="layui-form-label">
				<span class="x-red">*</span>考试时间
			</label>
			<div class="layui-input-inline">
				<input type="text" class="layui-input" id="bfdate" name="bfdate" placeholder="开始时间" value="{$list.data.bfdate|default=''}" autocomplete="off" lay-verify="required">
			</div>
			<div class="layui-input-inline">
				<input type="text" class="layui-input" id="enddate" name="enddate" placeholder="结束时间" value="{$list.data.enddate|default=''}" autocomplete="off" lay-verify="required">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<label for="fanwei_id" class="layui-form-label">查看范围</label>
		<div class="layui-input-block">
			<select name="fanwei_id" id="fanwei_id">
			</select>
		</div>
	</div>
	<div class="layui-form-item" style="text-align: right;">
		<button class="layui-btn" lay-filter="nextsubmit" lay-submit="">
			{$list.set.butname}
		</button>
	</div>
</form>
{/block}
{block name="myjs"}
<script>
// 日期控件
layui.use(['laydate', 'createInput','form'], function() {
	var laydate = layui.laydate,
		cInput = layui.createInput,
		form = layui.form;

		cInput.xueqiSelect('xueqi_id', "{$list.data.xueqi_id|default=''}");
	cInput.schoolSelect('zuzhi_id', '教研组', '区级', "{$list.data.zuzhi_id|default=''}", true);
	cInput.categorySelect('category_id', 109, "{$list.data.category_id|default=''}");
	cInput.categorySelect('fanwei_id', 124, "{$list.data.fanwei_id|default=''}");
	
	//开始时间
	laydate.render({
		elem: '#bfdate',
		type: 'datetime',
		trigger: 'click' //采用click弹出
			,
		min: -15 //今天
			,
		max: 30 //20天后
			,
		format: 'yyyy-M-d' //可任意组合
	});
	//结束时间
	laydate.render({
		elem: '#enddate',
		type: 'datetime',
		trigger: 'click' //采用click弹出
			,
		min: -15 //今天
			,
		max: 30 //20天后
			,
		format: 'yyyy-M-d' //可任意组合
	});

	//监听提交
	form.on('submit(nextsubmit)', function(data) {
		$.ajax({
			url: "{$list.set.url}",
			type: "{$list.set.formpost}",
			data: data.field,
			dataType: 'json',
			success: function(result) {
				if (result.val == 1) {
					$(location).attr('href', '/kaoshi/index/setp2/' + result.kaoshi_id);
				} else {
					layer.msg(result.msg);
				}
			},
			error: function(xhr, status, error) {
				layer.msg('数据处理错误', {
					icon: 2,
					time: 2000 //2秒关闭（如果不配置，默认是3秒）
				});
			}
		});
		return false;
	});

});

</script>
{/block}
